package Thread;
//线程等待
public class ThreadDemo10 {
    public static void main(String[] args) {
        Thread t=new Thread(){
            @Override
            public void run() {
                int count = 0;
                while (count<5){
                    count++;
                    System.out.println("线程运行中");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                System.out.println("线程执行完毕");
            }
        };
        t.start();
        try {
            t.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("join运行结果");

    }
}
